﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace BussinessLayer
{
    public class tblDoanvien
    {
        DataLayer.Data odata = new DataLayer.Data();

        public DataTable selectAll(string _namhoc)
        {
            return odata.view_text("select * from hocsinh_giaovien as hsgv left join doanvien as dv on hsgv.id=dv.id");
        }

        public void doanvien(int _id, DateTime _ngayvaodoan,string _donviketnap)
        {
            SqlParameter[] sp = new SqlParameter[3];
            sp[0] = new SqlParameter("@id", _id);
            sp[1] = new SqlParameter("@ngayvaodoan", _ngayvaodoan);
            sp[2] = new SqlParameter("@donviketnap", _donviketnap);
            odata.proc_TS("tblDoanvien", sp);
        }

        public DataTable SelectDVThuocChiDoan(int _chidoanID)
        {
            return odata.view_text("SELECT hsgv.id, hsgv.hoten, hsgv.ngaysinh, hsgv.gioitinh, hscd.chidoan_id FROM doanvien AS dv LEFT JOIN hocsinh_giaovien AS hsgv ON dv.id=hsgv.id LEFT JOIN hocsinh_chidoan AS hscd ON dv.id=hscd.id WHERE hsgv.lahocsinh='True'  AND hscd.chidoan_id='" + _chidoanID + "'");
        }

    }
}
